
//************************************************************************
// Table 6
//************************************************************************

global DATA  "path/to/input/data"   
global OUT "path/to/output/folder"
global INT "path/to/intermediate/files"

use "$DATA\twincites_applicant_did_prep_prenorm.dta", clear

drop if backcite_count_citing>100
sort family_cited priority_citing_d
duplicates drop family_cited nonJP, force
duplicates tag family_cited, gen(tag)
drop if tag==0
drop tag
replace lag=exp(lag)+546

display "=============================================="
display "Pre-AIPA"
sum lag if after_change_cited==0, detail
sum originality if after_change_cited==0, detail
sum science_cites if after_change_cited==0, detail
sum inventors_citing if after_change_cited==0, detail
sum cited_jp_it_fc if after_change_cited==0, detail
sum unique_inventors_citing_2000 if after_change_cited==0, detail
sum JP_app_preAIPA if after_change_cited==0, detail
display "=============================================="
display "Post-AIPA"
sum lag if after_change_cited==1, detail
sum originality if after_change_cited==1, detail
sum science_cites if after_change_cited==1, detail
sum inventors_citing if after_change_cited==1, detail
sum cited_jp_it_fc if after_change_cited==1, detail
sum unique_inventors_citing_2000 if after_change_cited==1, detail
sum JP_app_preAIPA if after_change_cited==1, detail


display "=============================================="
display "Normalised variables"

use "$DATA\twincites_applicant_did_prep.dta", clear

drop if backcite_count_citing>100
sort family_cited priority_citing_d
duplicates drop family_cited nonJP, force
duplicates tag family_cited, gen(tag)
drop if tag==0
drop tag

replace backcite_count_citing=ln(backcite_count_citing+1)
quietly: sum backcite_count_citing
replace backcite_count_citing=(backcite_count_citing)/r(sd)

display "=============================================="
display "Pre-AIPA"
sum originality if after_change_cited==0, detail
sum science_cites if after_change_cited==0, detail
sum inventors_citing if after_change_cited==0, detail
sum cited_jp_it_fc if after_change_cited==0, detail
sum firm_size if after_change_cited==0, detail

display "=============================================="
display "Post-AIPA"

sum originality if after_change_cited==1, detail
sum science_cites if after_change_cited==1, detail
sum inventors_citing if after_change_cited==1, detail
sum cited_jp_it_fc if after_change_cited==1, detail
sum firm_size if after_change_cited==1, detail










